
const { Model, DataTypes } = require('sequelize');
const sequelize = require( '../utils/sequelize' );

class Topic extends Model {
}

const attributes = {
    id: {
        type: DataTypes.STRING,
        primaryKey: true 
    },
    title: {
        type: DataTypes.STRING
    },
    content: {
        type: DataTypes.TEXT
    },
    publishTime: {
        type: DataTypes.DATE,
        field: "publish_time"
    },
    publishIp: {
        type: DataTypes.STRING,
        field: "publish_ip"
    },
    cid: {
        type: DataTypes.STRING
    }
}

const options = {
    sequelize,
    timestamps: false,
    tableName: 't_topics',
    modelName: 'topic'
}

Topic.init( attributes , options );

module.exports = Topic ;